import store from '@/store'

// 封装自定义指令并导出  将需要的指令按需导出
export const imgerror = {

  inserted: function(el, options) {
    el.onerror = () => {
      el.src = options.value
    }
  }
}

// 控制按钮权限的显示和隐藏
export const allow = {
  inserted: function(el, options) {
    // 获取用户的按钮级别的权限信息
    const point = store.state.user.userInfo.roles.points
    if (!point.includes(options.value)) {
      el.style.display = 'none'
    }
  }
}
